
package com.idealighter.game.games.wknh.handler;

import com.idealighter.game.core.annotation.ResMsgHandler;
import com.idealighter.game.games.wknh.WknhPlayer;
import com.idealighter.game.games.wknh.dto.BatteryInfo;
import com.idealighter.game.games.wknh.message.ResBatteryChangeMsg;
import com.idealighter.game.message.core.ResMessage;
import com.idealighter.game.robot.core.Player;
import com.idealighter.game.robot.handler.ResMessageHandler;


@ResMsgHandler(523232)
public class ResBatteryChangeHandler implements ResMessageHandler {

  // private static final Logger LOG = LoggerFactory.getLogger(ResBatteryChangeHandler.class);

  @Override
  public void action(Player player, ResMessage message) {
    ResBatteryChangeMsg msg = (ResBatteryChangeMsg) message;
    WknhPlayer wknhPlayer = (WknhPlayer) player;
    BatteryInfo battery = msg.getBattery();
    if (battery.getPlayerId() == wknhPlayer.playerId) {
      wknhPlayer.battery = msg.getBattery();
    }
  }
}
